package cm.unit2.theme4;

public class Fibonacci {

	public int fibonacci(int n) {
        if(n==0) return 0;
        if(n==1) return 1;
        else{
            return fibonacci(n-1)+fibonacci(n-2);
        }
    }
	
	public int Fibonacci02(int n) {
        if(n==0) return 0;
        if(n==1) return 1;
        int a = 0;
        int b = 1;
        int t = 0;
        int cnt = 2;
        while(cnt++ <= n){
            t = b;
            b = a + b;
            a = t;
        }
        return b;
    }
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
